package com.sjz.han.industry.adapters;

import android.content.Context;
import android.content.Intent;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.sjz.han.industry.R;
import com.sjz.han.industry.activites.ProductJsActivity;
import com.sjz.han.industry.entities.AllRadiosEntity;
import com.sjz.han.industry.entities.GongLueEntity;
import com.sjz.han.industry.entities.HomeEntity;
import com.sjz.han.industry.internetmanage.ReqestUrl;
import com.sjz.han.industry.utils.PicUtils;

import java.util.ArrayList;
import java.util.List;


/**
 *图文介绍适配器
 */
public class AllRadiosAdapter extends RecyclerView.Adapter<AllRadiosAdapter.ViewHolder> {
    private Context context;
    public List<AllRadiosEntity.AllRadiosData.AllRadios> datas=new ArrayList<>();
    public List<HomeEntity.HomeData.NoticeBean> datas2 = new ArrayList<>();
    public AllRadiosAdapter(Context context) {
        this.context=context;
    }

    @Override
    public int getItemCount() {
        return datas2 == null ? 0 : datas2.size();
    }

    public void setAdapterDatas(List<AllRadiosEntity.AllRadiosData.AllRadios> datas){
        this.datas=datas;
        notifyDataSetChanged();
    }
    public void setAdapterDatas2(List<HomeEntity.HomeData.NoticeBean> datas2){
        this.datas2 =datas2;
        notifyDataSetChanged();
    }
    @Override
    public AllRadiosAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        return new AllRadiosAdapter.ViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.adapter_allradios_item, parent, false));
    }

    @Override
    public void onBindViewHolder(AllRadiosAdapter.ViewHolder holder, final int position) {
       holder.guanbo_item.setText(datas2.get(position).content);
    }

    static class ViewHolder extends RecyclerView.ViewHolder {
        public TextView guanbo_item;
        public ViewHolder(View itemView) {
            super(itemView);
            guanbo_item=(TextView)itemView.findViewById(R.id.guanbo_item);
        }

    }
}